home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 4
/
Amiga Tools 4.iso
/
grafix
/
tools
/
xanim
/
xanimamigabeta7
/
xanim_egs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-16
|
3KB
|
150 lines
/*
Initialisation file for EGS
Compiled and tested
Author: Oliver Eichhorn
*/
#include <string.h>
#include <stdlib.h>
/*#include <proto/exec.h>*/
#include <egs/egs.h>
#include <egs/egsrequest.h>
#include <egs/egsblit.h>
#include <egs/proto/egs.h>
#include <egs/proto/egsrequest.h>
#include <egs/proto/egsblit.h>
struct E_EScreen *pEgsScreen = NULL;
struct Library *EGSBase = NULL;
struct Library *EGSRequestBase = NULL;
struct Library *EGSBlitBase = NULL;
/* i didnt find memstart in your merlin file, so here there's mine */
UBYTE *memstart;
/* The following stuff is for screenmode requester.
If you have the old EGS V5 includes (like me)
you will need this */
/*
typedef struct ER_ScrModeRequest *ER_ScrModeReqPtr;
struct ER_ScrModeRequest
{
struct ER_Request Req;
APTR Reserved1;
APTR Reserved2;
char *ScreenMode;
short Width;
short Height;
long Depths;
short Depth;
};
#pragma libcall EGSRequestBase ER_CreateScrModeReq 6C 801
ER_ScrModeReqPtr ER_CreateScrModeReq(ER_ReqContextPtr con);
*/
void CloseEGS()
{
if (pEgsScreen) E_CloseScreen(pEgsScreen);
if (EGSBase) CloseLibrary(EGSBase);
if (EGSRequestBase) CloseLibrary(EGSRequestBase);
if (EGSBlitBase) CloseLibrary(EGSBlitBase);
}
void OpenEGS()
{
struct ER_ReqContext *myReqContext = NULL;
struct ER_ScrModeRequest *myScrModeReq = NULL;
struct E_NewEScreen myNewEScreen;
/* open egs libraries */
EGSBase = OpenLibrary("egs.library", 6L);
if (!EGSBase)
{
CloseEGS();
exit(20);
}
EGSRequestBase = OpenLibrary("egsrequest.library", 6L);
if (!EGSRequestBase)
{
CloseEGS();
exit(20);
}
EGSBlitBase = OpenLibrary("egsblit.library", 6L);
if (!EGSBlitBase)
{
CloseEGS();
exit(20);
}
/* create screenmode requester */
myReqContext = ER_CreateReqContext();
if (!myReqContext)
{
CloseEGS();
exit(20);
}
myScrModeReq = ER_CreateScrModeReq(myReqContext);
if (!myScrModeReq)
{
ER_DeleteReqContext(myReqContext);
CloseEGS();
exit(20);
}
/* open screenmode requester to ask user for screenmode */
if (!ER_DoRequest((ER_RequestPtr)myScrModeReq))
{
ER_DeleteRequest((ER_RequestPtr)myScrModeReq);
ER_DeleteReqContext(myReqContext);
CloseEGS();
exit(20);
}
/* put together newscreen */
myNewEScreen.Mode = myScrModeReq->ScreenMode;
myNewEScreen.Depth = myScrModeReq->Depth;
myNewEScreen.Colors = NULL;
myNewEScreen.Map = NULL;
myNewEScreen.Flags = 0L;
myNewEScreen.Mouse = NULL;
myNewEScreen.EdcmpFlags = 0L;
myNewEScreen.Port = NULL;
/* open screen */
pEgsScreen = E_OpenScreen(&myNewEScreen);
ER_DeleteRequest(&myScrModeReq->Req);
ER_DeleteReqContext(myReqContext);
if (!pEgsScreen)
{
CloseEGS();
exit(20);
}
/* lock the screen bitmap, because it must not be swapped */
pEgsScreen->Map->Typekey.PixelMap.Planes.Lock++;
memstart = pEgsScreen->Map->Typekey.PixelMap.Planes.Dest;
}